<!-- {{useCss "/app-pages/css/user.css","/user/:user_page?"}} -->
{{useCss "/app-pages/css/goods_details.scss","/goods_details/:goods_details_page?"}}
<div class="goods-main">

    {{#> "goods-main-img","goods_detail"}}

    <div class="describe">
        <div class="goods-title">
            <p>{{goods_detail.goods_name}}</p>
            <div class="mini-describe">
                {{goods_detail.intro}}
            </div>
        </div>

        <hr />

        <div class="price-describe">
            <div class="price">
                <span class="title">价格:</span>
                <span class="money">{{goods_detail.price_toFixed_2+"/"+goods_detail.unit}}</span>
            </div>

            <div class="freight">
                <span class="title">运费:</span>
                <span class="money">{{goods_detail.fare_toFixed_2}}</span>
            </div>
            {{#if goods_detail.limit}}
            <div>
                <span class="title">限购</span>
                <span class="money">{{goods_detail.limit}}</span>
            </div>
            {{/if}}
            <div>
                <span class="title">存货:</span>
                <span class="money">{{goods_detail.num}}</span>
            </div>
        </div>


        <hr />

        <inputnumber min=0 max="{{goods_detail.num}}" value="1" bind-input="{{'$Cache.goods_details.buy_number'}}"></inputnumber>
        <hr />

        <div class="submit">

            <div class="button">
                {{#if goods_detail.num}}
                <div>
                    <button event-click="{{'$Event.goods_details.goods.add_to_cart'}}">添加购物车</button>
                </div>
                {{#else}}
                <button class="add_cart" disabled style="background-color:red;display:block;margin-left:0;cursor:default">此商品暂时缺货</button>
                {{/if}}
                <a event-click="{{'$Event.goods_details.goods.collect_toggle'}}" class="{{$Cache.goods_detail.is_collect&&'icon-star3'||'icon-star'}}">{{$Cache.goods_detail.is_collect&&'已收藏'||'点击收藏'}}</a>
                <br/>
                <br/>
                <br/>
                <div id="shareSNS">
                    <share share-init-key="{{goods_detail.goods_name}}" share-text="【{{goods_detail.goods_name}}】{{goods_detail.intro}}" share-detail="我觉得“{{goods_detail.goods_name}}”还不错，推荐大家一起用。" share-img="{{goods_detail.preview_img_url}}"></share>
                </div>
            </div>
            <qrcode srt="{{$Cache.recommender_url}}" logo="{{bus_info.info.logo_url}}"></qrcode>



        </div>
    </div>


</div>


<div class="evaluation">
    <div class="nav-bar">
        <href to="/goods_details/details.html?id={{goods_detail._id}}">
            <div class="list">商品详情</div>
        </href>
        <href to="/goods_details/comments.html?id={{goods_detail._id}}">
            <div class="list">购买评论</div>
        </href>
    </div>


    <div class="info">
        {{#teleporter "details"}}
    </div>
</div>
<script type="text/vm">
function(vm) {
    Path.registerjSouperRoute("/goods_details/:goods_details_page?", function(loc) {
        var _emit_lock = true;
        var goods_details_page = this.params.goods_details_page;
        console.log(goods_details_page);
        return ({
            href: loc.href,
            html: "/app-pages/pages/goods_details/",
            js: "/app-pages/js/goods_details/",
            prefix: "/goods_details/", //URL-pathname中无用的前缀部分，用来过滤href得出pagename 
            tel: "details",
            default: "details",
            pagename_handler: function(pagename) {
                //过滤出来的pagename在这里处理·二次处理pagename 
                //过滤掉后缀 
                return jSouper.$.lst(pagename, ".") || pagename;
            },
            index: 1,
            vm: vm
        });
    });
};
</script>
